#include <stdio.h>

int main(void) {
	char c;
	int numberToPrint;
	scanf("%d %c", &numberToPrint, &c);
	int numberOfTowRow = 6;
	int row = 0;
	int width = numberToPrint > 0 ? 1 : 0;
	// 减去中间行
	numberToPrint -= 1;
	// 得到上半部分的行数和宽度
	while (numberToPrint - numberOfTowRow >= 0) {
		row++;
		numberToPrint -= numberOfTowRow;
		width = numberOfTowRow / 2;
		numberOfTowRow += 4;
	}
	int remain = numberToPrint > 0 ? numberToPrint : 0;
	int rowNumber = width;
	int blankNumber = 0;
	// 打印上半部分 + 中间行
	for (int i = 0; i < row + 1; i++) {
		for (int j = 0; j < blankNumber; j++) {
			printf("%c", ' ');
		}
		for (int j = 0; j < rowNumber; j++) {
			printf("%c", c);
		}
		blankNumber++;
		rowNumber -= 2;
		printf("\n");
	}
	// 打印下半部分
	rowNumber = 3;
	blankNumber = (width - rowNumber) / 2;
	for (int i = 0; i < row; i++) {
		for (int j = 0; j < blankNumber; j++) {
			printf("%c", ' ');
		}
		for (int j = 0; j < rowNumber; j++) {
			printf("%c", c);
		}
		blankNumber--;
		rowNumber += 2;
		printf("\n");
	}
	printf("%d\n", remain);
	return 0;
}

